<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    EnableEventValidation="false" CodeBehind="Apply.aspx.cs" Inherits="Wicresoft.RDW.Request.VisitApply" %>

<%@ Register Src="../UserControls/RequestBasicControl.ascx" TagName="RequestBasicControl"
    TagPrefix="uc2" %>
<%@ Register Src="../UserControls/VisitRequestControl.ascx" TagName="VisitRequestControl"
    TagPrefix="uc1" %>
<%@ Register Src="../UserControls/TestRequestControl.ascx" TagName="TestRequestControl"
    TagPrefix="uc3" %>
<%@ Register Src="../UserControls/RentRequestControl.ascx" TagName="RentRequestControl"
    TagPrefix="uc4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .divMessageSummay
        {
            padding: 5px 30%;
            border: 1px solid red;
            color: Red;
            background-color: #eee;
        }
        .divMessageSummay li
        {
            list-style-type: disc;
            float: none !important;
            width: 100% !important;
        }
        #approval
        {
            text-align: right;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            $("#comments").dialog({
                modal: true,
                autoOpen: false

            });

            $("#<%=btnReturn.ClientID %>").click(checkAllTextValid);
            $("#<%=btnSaveDraft.ClientID %>").click(checkAllTextValid);
            $("#<%=btnSave.ClientID %>").click(checkAllTextValid);
            $("#<%=btnCancel.ClientID %>").click(checkAllTextValid);

            $("#<%=btnRejected.ClientID %>,#<%=btnAskForMore.ClientID %>").click(function () {
                $("#comments").css("display", "block");
                if ($.browser.msie && ($.browser.version == "6.0")) {
                    $("#divBasicInfo").css("display", "none");
                    $("#divPart3").css("display", "none");
                }
                $("#ui-dialog-title-comments").html("<%=Resources.NameResource.InsertComment %>");
                var type = $(this).attr("operatetype");
                $("#<%=txtStatus.ClientID %>").val(type);
                $("#<%=btnRejected.ClientID %>,#<%=btnAskForMore.ClientID %>,#<%=btnApprov.ClientID %>").attr("disabled", "disabled");
                $("#<%=commentValidate.ClientID %>").removeAttr("disabled");
                showComment();

            });
            $(".ui-dialog-titlebar-close").click(function () {
                $("#<%=btnRejected.ClientID %>,#<%=btnAskForMore.ClientID %>,#<%=btnApprov.ClientID %>").removeAttr("disabled");
                if ($.browser.msie && ($.browser.version == "6.0")) {
                    $("#divBasicInfo").css("display", "block");
                    $("#divPart3").css("display", "block");
                }
            });

            $("#<%=btnClose.ClientID %>").live('click', closeComment);
            $("#<%=btnApprov.ClientID %>").click(function () {

                $("#<%=commentValidate.ClientID %>").attr("disabled", "disabled");

            });
        });
        function showComment() {
            $("#comments").dialog({
                modal: true,
                autoOpen: true,
                draggable: false,
                maxWidth: 250,
                maxHeight: 250,
                resizable: false

            });
        };
        function closeComment() {
            var errormessage = $("#<%=ValidationSummary1.ClientID %>").html().replace(" ", "");
            if (errormessage != "") {
                $(".ui-dialog-titlebar-close").click();
            }
            var comment = $("#<%=txtNewComments.ClientID %>").val();
            $("#<%=NewComments.ClientID %>").val(comment);
            $("#comments").dialog("close");
            $("#<%=btnSubmit.ClientID %>").click();
        };
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="approval">
        <asp:Button ID="btnApprov" runat="server" CausesValidation="false" OnClick="btnApprov_Click"
            OnClientClick="this.disabled=disabled;" />
        <asp:Button ID="btnRejected" runat="server" operatetype="Rejected" />
        <asp:Button ID="btnAskForMore" runat="server" operatetype="AskForMore" />
        <asp:TextBox ID="txtStatus" runat="server" Style="display: none;" />
        <asp:TextBox ID="NewComments" runat="server" Style="display: none;" />
        <p>
            <asp:Button ID="btnSubmit" runat="server" Text="" CausesValidation="false" OnClick="btnSubmit_Click"
                Style="display: none;" CssClass="sqbtnPane" />
        </p>
    </div>
    <div id="comments" style="display: none;">
        <asp:TextBox ID="txtNewComments" runat="server" TextMode="MultiLine" Rows="4" Width="260"
            Wrap="true"></asp:TextBox>
        <asp:RequiredFieldValidator ID="commentValidate" runat="server" ErrorMessage="*"
            ControlToValidate="txtNewComments" ForeColor="Red" Display="none" />
        <asp:RegularExpressionValidator ID="txtConclusionValidator" ControlToValidate="txtNewComments"
            ValidationExpression="^[\s\S]{1,100}$" runat="server" Display="None" />
        <asp:Button ID="btnClose" runat="server" />
    </div>
    <div>
        <asp:ValidationSummary ID="ValidationSummary1" DisplayMode="BulletList" CssClass="divMessageSummay"
            runat="server" />
    </div>
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <uc2:RequestBasicControl ID="RequestBasic" runat="server" />
    <asp:PlaceHolder ID="phVisit" runat="server" Visible="false">
        <uc1:VisitRequestControl ID="VisitRequest" runat="server" />
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="phRent" runat="server" Visible="false">
        <uc4:RentRequestControl ID="RentRequest" runat="server" />
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="phTesting" runat="server" Visible="false">
        <uc3:TestRequestControl ID="TestingRequest" runat="server" />
    </asp:PlaceHolder>
    <div class="sqbtnPane">
        <p class="sqbtn">
            <asp:Button ID="btnReturn" runat="server" CausesValidation="false" OnClick="btnReturn_Click" /></p>
        <p class="sqbtn">
            <asp:Button ID="btnSaveDraft" runat="server" CausesValidation="false" OnClick="btnSaveDraft_Click" /></p>
        <p class="sqbtn">
            <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" /></p>
        <p class="sqbtn">
            <asp:Button ID="btnSaveAskForMore" runat="server" OnClick="btnSaveAskForMore_Click"
                Visible="false" /></p>
        <p class="sqbtn">
            <asp:Button ID="btnCancel" CausesValidation="false" runat="server" OnClick="btnCancel_Click" /></p>
    </div>
</asp:Content>
